package com.jueyue.dao.util;

import java.util.ResourceBundle;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PublicUtil {

	private static final Logger logger = LoggerFactory
			.getLogger(PublicUtil.class);

	private static ResourceBundle bundle;

	static {
		try {
			bundle = ResourceBundle.getBundle("SJTool");
		} catch (Exception e) {
			logger.info("SringJdbcTool没有配置配置文件,使用缺省配置");
			bundle = ResourceBundle
					.getBundle("com/jueyue/dao/util/DefaultSJTool");
		}
	}

	/**
	 * 判断传入参数是不是基本类型
	 * 
	 * @param clz
	 * @return
	 */
	public static boolean isWrapClass(Class<?> clz) {
		try {
			return ((Class<?>) clz.getField("TYPE").get(null)).isPrimitive();
		} catch (Exception e) {
			return clz.getName().equals("java.lang.String");
		}
	}

	/**
	 * 获取配置参数
	 * 
	 * @date 2014年1月13日
	 * @param name
	 * @return
	 */
	public static String getProperties(String name) {
		String value = bundle.getString(name);
		return value.trim();
	}

}
